package com.mg.framework.tiled;

import java.util.Properties;

import android.graphics.Bitmap;

public class Tile {

	private Bitmap image;
	private int id;
	private Properties properties;
	private TileSet tileSet;

	public Tile() {
		this.id = -1;
		this.properties = new Properties();
	}

	public int getId() {
		return this.id;
	}

	public void setTileSet(TileSet tileSet) {
		this.tileSet = tileSet;
	}

	public void setImage(Bitmap img) {
		this.image = img;
	}

	public int getWidth() {
		if (image != null)
			return image.getWidth();
		return 0;
	}

	public int getHeight() {
		if (image != null)
			return image.getHeight();
		return 0;
	}

	public void setId(int i) {
		this.id = i;
	}

	public Properties getProperties() {
		return properties;
	}

	public void setProperties(Properties p) {
		properties = p;
	}

	public Bitmap getTileBitmap() {
		return this.image;
	}

	public boolean isMe(String type) {
		if (type.equals(properties.get("type"))) {
			return true;
		}
		return false;
	}

	public String getType() {
		return this.properties.get("type").toString();
	}
}
